package com.itsm.sheet.controller;


import com.itsm.common.core.domain.R;
import com.itsm.common.sheet.JzsyEventSheetProcessDto;
import com.itsm.common.sheet.TransferSheetDto;
import com.itsm.sheet.entity.JzsyEventSheetProcess;
import com.itsm.sheet.service.IJzsyEventSheetProcessService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "事件单相应")
@RestController
@RequestMapping("/itsm/eventSheetPorcess")
public class JzsyEventSheetProcessController {

    @Autowired
    private IJzsyEventSheetProcessService jzsyEventSheetProcessService;


    /**
     * 认领工单
     * */
    @PostMapping("claimSheet")
    public R<?> claimSheet(@RequestBody JzsyEventSheetProcessDto jzsyEventSheetProcessDto){
        JzsyEventSheetProcess jzsyEventSheetProcess= jzsyEventSheetProcessService.claimSheet(jzsyEventSheetProcessDto);
        return jzsyEventSheetProcess!=null ? R.ok(jzsyEventSheetProcess) : R.fail("认领失败!");
    }


    /**
     * 转单
     * */
    @PostMapping("transferSheet")
    public R<?> transferSheet(@RequestBody TransferSheetDto transferSheetDto){
        JzsyEventSheetProcess jzsyEventSheetProcess= jzsyEventSheetProcessService.transferSheet(transferSheetDto);
        return jzsyEventSheetProcess!=null ? R.ok(jzsyEventSheetProcess) : R.fail("认领失败!");
    }

    /**
     * 升级
     * */
    @PostMapping("upgradeSheet")
    public R<?> upgradeSheet(@RequestBody TransferSheetDto transferSheetDto){
        JzsyEventSheetProcess jzsyEventSheetProcess= jzsyEventSheetProcessService.upgradeSheet(transferSheetDto);
        return jzsyEventSheetProcess!=null ? R.ok(jzsyEventSheetProcess) : R.fail("认领失败!");
    }





}
